﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace Steer
{
	public partial class AvoidTest : UserControl
	{
        List<Circle> circles;
		public AvoidTest()
		{
			// Required to initialize variables
			InitializeComponent();

            Loaded += new RoutedEventHandler(AvoidTest_Loaded);
		}

        void AvoidTest_Loaded(object sender, RoutedEventArgs e)
        {
            myWander.position = new Vector2D(200, 200);
            Circle1.init(100, Colors.Orange);
            Circle1.x = 600;
            Circle1.y = 200;

            Circle2.init(70, Colors.Red);
            Circle2.x = 100;
            Circle2.y = 300;

            circles = new List<Circle>();
            circles.Add(Circle1);
            circles.Add(Circle2);

            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
        }

        void CompositionTarget_Rendering(object sender, EventArgs e)
        {
            myWander.wander();
            myWander.avoid(circles);
            myWander.update();
        }
	}
}